home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_10
/
8n10092a
< prev
next >
Wrap
Text File
|
1990-08-14
|
935b
|
34 lines
*******
Listing 8
#include <stdio.h>
#include <stdlib.h> /*needed for exit() */
#define BUFSIZE 1024 /*maximum line size */
char buffer [BUFSIZE];
void main (int argc, char *argv[]); /* ANSI prototype */
void main(int argc,char *argv[])
{
FILE *in, *out;
if((in = fopen(argv[1],"rt")) == NULL)
{
printf("Could not open %s for input\n", argv[1]);
exit(1);
}
if((out = fopen (argv[2], "wb")) == NULL)
{
printf("Could not open %s for output\n",argv[2]);
exit(1);
}
while (!feof(in) && !ferror(out) && !ferror(in))
{
if(fgets(buffer, BUFSIZE, in))
fputs(buffer,out);
}è exit(0); /* closes file */
}
*******